cmake_minimum_required(VERSION 2.8)

SET(PRJ_NAME 				geoip)

SET(PRJ_ROOTDIR				${CMAKE_CURRENT_SOURCE_DIR} )

# $ sudo apt install libssl-dev 
#SET(OPENSSL_DIR				/usr/lib/x86_64-linux-gnu)

PROJECT(${PRJ_NAME} C )

MESSAGE(STATUS "Building geoip routine.")

INCLUDE_DIRECTORIES( 
	"${PRJ_ROOTDIR}/cJSON"
)

LINK_DIRECTORIES(
	"/usr/lib/x86_64-linux-gnu"
)
	
	SET(cflags	-std=gnu99)
	ADD_DEFINITIONS(${cflags})

	SET(SRCLIST_geoip
		${PRJ_ROOTDIR}/cJSON/cJSON.c
		${PRJ_ROOTDIR}/geoip.c
	)

	#ADD_LIBRARY(posixfifo SHARED ${PRJ_ROOTDIR}/posixfifo.c)

	ADD_EXECUTABLE(geoip  ${SRCLIST_geoip} )
	TARGET_LINK_LIBRARIES(geoip  
	-lcurl		## $ sudo apt install libcurl4-openssl-dev 
	-lz -lpthread
	-lssl -lcrypto
	)